﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/SAFS.Master" CodeBehind="Foros.aspx.vb" Inherits="Template_SAFS_VB.Foros" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
	<link rel="stylesheet" href="css/Estilo.css" type="text/css" />
	<!-- include CSS & JS files -->
	<!-- CSS file -->
	<link rel="stylesheet" type="text/css" href="css/jRating.jquery.css" media="screen" />
	<link type='text/css' href='css/osx.css' rel='stylesheet' media='screen' />
	<!-- jQuery files -->
	<script type="text/javascript" src="jquery/jquery.js"></script>
	<script type="text/javascript" src="jquery/jRating.jquery.js"></script>
	<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
	<script type='text/javascript' src='js/osx.js'></script>
    <script type="text/javascript" src="js/jquery.blockUI.js"></script>
    <script type="text/javascript" src="js/Foros.js"></script>
	<link rel="stylesheet" type="text/css" href="css/demo.css" />
	<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
	<script type="text/javascript" src="js/script.js"></script>
	<link href="css/modern.css" rel="stylesheet"/>
    <link href="css/modern-responsive.css" rel="stylesheet"/>
    <link href="css/site.css" rel="stylesheet" type="text/css"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


<div align="left">
    <div class="page-header-content">
    <div><h1><img src="images/back_button.png"  alt="" class="back_button" title="Atras" onclick="history.back()" />Lista de foros</h1><br /><br /></div>
     </div>   	
    <ul class="container">
        

        <% 
            Dim foros As List(Of Dictionary(Of String, Object)) = getListaForos()
            Dim temas As List(Of Dictionary(Of String, String))
            Dim html As String = ""
            Dim temaAbierto As String = "<img class='iconsForo2' src='images/check.png' title='Abierto'/>"
            Dim temaCerrado As String = "<img class='iconsForo2' src='images/icono-candado.jpg' title='Cerrado'/>"
            Dim estadoTema As String = ""
            Dim rol As Integer = Session("rol")

            
            For Each foro As Dictionary(Of String, Object) In foros
                
                If rol = 1 Then
                    html = "<li class='menu'>" &
                        "<ul>" &
                       "<li id='" & foro("id") & "' name='" & foro("nombre") & "' style='background-color:white' class='button tema_get'><a href='#' class='blue' style='vertical-align:text-top;font-size:17px'>" & foro("nombre") &
                       "<span></span></a></li><!-- Fin Foro-->" &
                        "<li class='dropdown'><ul class='listview'><!-- Tema-->"
                        
                Else
                    html = "<li class='menu'>" &
                         "<ul>" &
                       "<!-- Foro-->" &
                       "<img id='" & foro("id") & "' src='images/expand32-black.png' class='iconsForo tema_add' title='Agregar tema'/>" &
                       "<img id='" & foro("id") & "' src='images/modificar.jpg' class='iconsForo foro_mod' title='Modificar tema'/>" &
                       "<li id='" & foro("id") & "' name='" & foro("nombre") & "' style='background-color:white' class='button tema_get'><a href='#' class='blue' style='vertical-align:text-top;font-size:17px'>" & foro("nombre") &
                       "<span></span></a></li><!-- Fin Foro-->" &
                        "<li class='dropdown'><ul class='listview'><!-- Tema-->"
                End If
                
               
                temas = CType(foro("temas"), List(Of Dictionary(Of String, String)))
               
           
                If temas.Count > 0 Then
                    
                    For Each tema As Dictionary(Of String, String) In temas
                       
                        If CType(tema("abierto"), Boolean) = True Then
                            estadoTema = temaAbierto
                            
                        Else
                            estadoTema = temaCerrado
                        End If
                        
                        html = html & getOpcionesUsuario(CType(tema("abierto"), Boolean), tema("id"), tema("nombre"), estadoTema, getDuenoForo(foro("id")))
                        
                    Next
                    
                Else
                    
                    html = html & "<ul>" &
                                   "<li> Este foro no posee  temas.</li>" &
                                   "</ul>"
                                  
                End If
                
                html = html & "</ul></li><!--Fin tema--></ul></li>"
          
                Response.Write(html)          
            Next
                                           
            %> 
            
    </ul>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
</asp:Content>
